package Interfaces;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;

public class Bienvenido extends javax.swing.JDialog implements ActionListener{
	private static final long serialVersionUID = 1L;
	public JTextField txtNroSeccion;
	public JLabel lblNroSeccion;
	public JLabel lblTitulo;
	public JButton btnIr;
	//Constructor de la Clase
	public Bienvenido(){
		setTitle("Registro de la seccion");
		setSize(280,200);
		setLocation(300, 200);
		setResizable(false);
		setLayout(new GridLayout(4,1));
		
		txtNroSeccion = new JTextField(5);		
		lblTitulo = new JLabel(".-. Registrar Seccion .-.");
		lblNroSeccion = new JLabel("Numero de Seccion:");
		btnIr = new JButton("Ir");
		
		JPanel pnTitulo = new JPanel(new FlowLayout(FlowLayout.CENTER));
		JPanel panel1= new JPanel(new FlowLayout(FlowLayout.LEFT));
		JPanel pnSur = new JPanel(new FlowLayout(FlowLayout.LEFT));
		JPanel pnnorte = new JPanel(new FlowLayout(FlowLayout.LEFT));
		JPanel panel2= new JPanel(new FlowLayout(FlowLayout.CENTER));
		
		pnTitulo.add(lblTitulo);
		panel1.add(lblNroSeccion);
		panel1.add(txtNroSeccion);
		pnnorte.add(panel1);
		panel2.add(btnIr);
		
		pnSur.add(panel2);
		add(pnTitulo);
		add(pnnorte);
		add(panel2);
		
		btnIr.addActionListener(this);
	}
	public void actionPerformed(ActionEvent accion) {
		if(accion.getSource()==this.btnIr){
			if(!this.txtNroSeccion.getText().equals("")){
			fmrMenu frmmenu =new fmrMenu();
			this.setVisible(false);
			frmmenu.setVisible(true);
			}
			else
				 JOptionPane.showMessageDialog(null,"Debes introducir el numero de la seccion","Registrar seccion", 
							JOptionPane.ERROR_MESSAGE);
		}
	
		
	}

	
			
	


}
